<link rel="stylesheet" href="<?php echo $this->webroot;?>css/bootstrap-tagsinput.css"/>
<script type="text/javascript" src="<?php echo $this->webroot;?>js/typeahead.min.js"></script>    
<script type="text/javascript" src="<?php echo $this->webroot;?>js/bootstrap-tagsinput.min.js"></script>    
<div class="row">
    <div class="col-md-8 col-md-offset-2" style="background: #fff; padding-bottom: 50px;">
        <h2 class="text-center"><?php echo __("INSERISCI PAGAMENTO") ?></h2>
        <form role="form" name="Link" method="post" action="<?php echo $this->webroot?>Pagamento/save" >
          <input type="hidden" name="Pagamento[id]" id="pagamento_id" value="" />
          <br>
		  <div class="row">
	          <div class="form-group  col-md-12">
	            <label for="bookmaker_id">Bookmaker associato:</label>
	                <?php foreach ($bookmaker_list as $bookmaker) { 
	                	if ($bm["Bookmaker"]["id"]==$bookmaker["Bookmaker"]["id"]) { ?>
				          <input type="hidden" name="Pagamento[bookmaker_id]" value="<?php echo $bookmaker["Bookmaker"]["id"] ?>" />
	                      <label ><?php echo $bookmaker["Bookmaker"]["nome"]; ?></label>
	                	<?php } ?>
	                <?php } ?>
	          </div>
		  </div>
		  <div class="row">
	           <div class="form-group  col-md-12">
	            <label for="lang_id">Pagamento:</label><br>
	            <select style="width: 393px;" id="bookmaker_id" name="Pagamento[metodo]">
	                <?php foreach ($this->Session->read("pagamentolist") as $key => $metodo) { ?>
	                    <option value="<?php echo $key; ?>"><?php echo $metodo["name"]; ?></option>
	                <?php } ?>
	            </select>   
	          </div>
		  </div>
		  <div class="row">
	          <div class="form-group  col-md-12">
	           <!-- Nav tabs -->
	            <ul class="nav nav-tabs">
	              <li class="active"><a href="#ita" data-toggle="tab">Ita</a></li>
	              <li><a href="#eng" data-toggle="tab">Eng</a></li>
	            </ul>
	            <!-- Tab panes -->
	            <div class="tab-content">
	              <div class="tab-pane fade in active" id="ita">
	                 <div class="form-group">
	                    <label for="descrizione">Descrizione italiano:</label>
	                    <textarea rows="10" class="form-control" name="PagamentoLang[ita][descrizione]" ></textarea>
	                  </div>
	              </div>
	              <div class="tab-pane fade in" id="eng">
	                   <div class="form-group">
	                    <label for="descrizione">Descrizione inglese:</label>
	                    <textarea rows="10" class="form-control" name="PagamentoLang[eng][descrizione]" ></textarea>
	                  </div>
	              </div>
	            </div>
	          </div>   
		  </div>
		  <div class="row">
	          <div class="col-md-12 ">
	              <button type="submit" class="btn btn-primary">Salva</button>
	              <a  href="<?php echo $this->webroot?>Bookmakers/edit/<?php echo $bm["Bookmaker"]["id"]; ?>" class="btn">Annulla</a>
	          </div>
		  </div>
        </form>
   </div>
  </div>
  <script>
      
  
    
    function format(data) {
        console.log(data);
        return "<img class='banner_thumb' src='<?php echo $this->webroot?>" + data.id + "'/>" + data.text;
    }
    
    $(document).ready(
        function() { 
            
            $("#bookmaker_id,#lang_id").select2({
                placeholder: "Seleziona un valore"
            }); 
            
        });
      
  </script>